import tool from '../tool'
import util from '_util/index'
import _ from 'lodash'
import in_array from 'in_array'

export default{
    get_fval(_this,fname,val,type=null){
        let fvals = util.store.get(_this, `search_fval.${_this.ctl}`, 'list');
        let fval = '';
        if(fvals) {
            if(fvals[fname])
                fval=fvals[fname][val]
        }
        return fval;
    },
    set_fval_tmp(_this,fname,val,fval){

        let tmp = util.store.get(_this, `search_fval_tmp.${_this.ctl}`, 'list')||{};
        tmp[fname] =  {};
        if(val)
            tmp[fname][val] = fval;
        util.store.push(_this, 'set_search_fval_tmp', 'search_fval_tmp', _this.ctl, tmp, 'list');

    },
    set_fval(_this){

        let tmp = util.store.get(_this, `search_fval_tmp.${_this.ctl}`, 'list')||{};
        let _tmp = util.deepCopy(tmp);
        util.store.push(_this, 'set_search_fval', 'search_fval', _this.ctl, _tmp, 'list');

    },
    sync_fval_tmp(_this){

        let tmp = util.store.get(_this, `search_fval.${_this.ctl}`, 'list')||{};
        let _tmp = util.deepCopy(tmp);
        util.store.push(_this, 'set_search_fval_tmp', 'search_fval_tmp', _this.ctl, _tmp, 'list');

    },
    not_need_create(_this){

        return ['TransferDetail'].contains(_this.ctl);

    },
    get_not_useModal(_this){

        let name = [];
        let bind_mid = [];
        switch (_this.ctl) {
            case 'Qd':
                name = ['model_scode'];
                bind_mid = [37];
                break;

        }
        // let b = _this.bind_mid==bind_mid && _this.name==name;
        let b = bind_mid.contains(_this.bind_mid) && name.contains(_this.name);
        return b;

    }
}